use strict;
use warnings;

use Arcos::Test::Script;
use Test::More;

use Arcos::Test;

BEGIN { Arcos::Test->plan_if_queued_stopped(tests => 8) }

use_ok('Arcos::JobQueue');

eval { Arcos::JobQueue->submit_job(); };
like($@, qr/parameters/, 'caught missing param');

eval { Arcos::JobQueue->submit_job(type => 'foo'); };
like($@, qr/parameters/, 'caught missing param');

eval { Arcos::JobQueue->submit_job(parameters => undef); };
like($@, qr/parameters/, 'caught missing param');

eval { Arcos::JobQueue->submit_job(parameters => {foo => 1}); };
like($@, qr/parameters/, 'caught missing param');

eval {
    Arcos::JobQueue->submit_job(type       => 'foo',
                                parameters => {foo => 1},
                                bogus      => 7);
};
like($@, qr/parameters/, 'caught invalid param');

eval {
    Arcos::JobQueue->submit_job(type => 'test_job', parameters => {foo => 1});
};
like($@, qr/Invalid job type/, 'invalid job type caught by submit_job');

my $accepted = Arcos::JobQueue->accept_next_job(types => ['will not match']);
is($accepted, undef);
